/* 
 * 猫狗识别系统样式表
 * 功能：定义整个Web应用的视觉样式和交互效果
 * 特点：现代化设计、响应式布局、流畅动画
 */

/* 全局样式重置和基础设置 */
* {
    margin: 0;           /* 清除所有元素的默认外边距 */
    padding: 0;          /* 清除所有元素的默认内边距 */
    box-sizing: border-box;  /* 使用border-box盒模型，便于布局计算 */
}

/* 页面主体样式：设置字体、背景和基础布局 */
body { 
    /* 字体栈：优先使用微软雅黑，依次降级到其他字体 */
    font-family: 'Microsoft YaHei', 'Segoe UI', 'Roboto', Arial, sans-serif; 
    /* 渐变背景：从蓝紫色到深紫色的135度线性渐变 */
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;   /* 最小高度为视口高度，确保背景覆盖整个屏幕 */
    padding: 20px;       /* 页面四周留白20像素 */
    line-height: 1.6;    /* 行高1.6倍，提高文本可读性 */
}

/* 主容器样式 */
.container {
    max-width: 1000px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 25px;
    padding: 40px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.15);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.2);
}

/* 头部样式 */
.header {
    text-align: center;
    margin-bottom: 30px;
}

.header h1 {
    color: #333;
    margin-bottom: 15px;
    font-size: 2.8em;
    font-weight: 800;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: #666;
    font-size: 1.2em;
    font-weight: 500;
}

/* 版本信息卡片 */
.version-info {
    text-align: center;
    background: linear-gradient(135deg, #e8f4fd 0%, #fce4ec 100%);
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 35px;
    border-left: 5px solid #2196f3;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
}

.version-info strong {
    display: block;
    font-size: 1.1em;
    margin-bottom: 15px;
    color: #1976d2;
}

.features-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    margin-top: 15px;
    font-size: 0.95em;
}

.feature-item {
    background: rgba(255,255,255,0.7);
    padding: 8px 12px;
    border-radius: 8px;
    border-left: 3px solid #4caf50;
    transition: all 0.3s ease;
}

.feature-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

/* 上传区域样式 */
.upload-area { 
    border: 3px dashed #ddd; 
    padding: 60px 30px; 
    text-align: center; 
    margin: 40px 0;
    border-radius: 20px;
    transition: all 0.4s ease;
    cursor: pointer;
    background: linear-gradient(135deg, #f8f9ff 0%, #fff8f8 100%);
    position: relative;
    overflow: hidden;
}

.upload-area::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(102, 126, 234, 0.1), transparent);
    transform: rotate(45deg);
    transition: all 0.6s ease;
    opacity: 0;
}

.upload-area:hover::before {
    opacity: 1;
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

.upload-area:hover {
    border-color: #667eea;
    background: linear-gradient(135deg, #f0f4ff 0%, #fff0f0 100%);
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
}

.upload-area.dragover {
    border-color: #667eea;
    background: linear-gradient(135deg, #e8f0ff 0%, #ffe8e8 100%);
    transform: scale(1.02);
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
}

.upload-text {
    position: relative;
    z-index: 1;
}

.upload-icon {
    font-size: 3em;
    margin-bottom: 15px;
    display: block;
}

.upload-title {
    font-size: 26px;
    margin: 0;
    font-weight: bold;
    color: #333;
}

.upload-subtitle {
    color: #999;
    margin: 15px 0 0 0;
    font-size: 16px;
}

.upload-hint {
    color: #666;
    margin: 15px 0 0 0;
    font-size: 14px;
}

/* 按钮样式 */
button { 
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white; 
    padding: 18px 45px; 
    border: none; 
    border-radius: 35px; 
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    transition: all 0.4s ease;
    display: block;
    margin: 35px auto;
    min-width: 220px;
    position: relative;
    overflow: hidden;
}

button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

button:hover::before {
    left: 100%;
}

button:hover { 
    transform: translateY(-3px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.2);
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
}

button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

button:disabled::before {
    display: none;
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 22px;
    height: 22px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top: 3px solid #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 12px;
    vertical-align: middle;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 结果显示区域样式 */
.result { 
    margin: 40px 0; 
    padding: 30px; 
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.result.success {
    background: linear-gradient(135deg, #e8f5e8 0%, #c8e6c9 100%);
    border-left: 6px solid #4caf50;
}

.result.error {
    background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
    border-left: 6px solid #f44336;
}

.result h3 {
    margin-top: 0;
    font-size: 1.8em;
    margin-bottom: 20px;
    text-align: center;
}

/* 图片预览样式 */
.preview { 
    max-width: 450px; 
    margin: 25px auto;
    display: block;
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.2);
    transition: all 0.4s ease;
}

.preview:hover {
    transform: scale(1.05) rotate(1deg);
    box-shadow: 0 20px 45px rgba(0,0,0,0.25);
}

/* 置信度条样式 */
.confidence-bar {
    background: #e0e0e0;
    border-radius: 20px;
    overflow: hidden;
    margin: 20px 0;
    height: 35px;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.confidence-fill {
    height: 100%;
    background: linear-gradient(90deg, #4caf50, #8bc34a, #cddc39);
    transition: width 1s ease-out;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 16px;
    border-radius: 20px;
    position: relative;
    overflow: hidden;
}

.confidence-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: confidence-shine 2s ease-in-out;
}

@keyframes confidence-shine {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* 详细信息网格 */
.details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    margin: 25px 0;
}

.detail-item {
    text-align: center;
    padding: 20px;
    background: rgba(255,255,255,0.8);
    border-radius: 15px;
    border: 2px solid transparent;
    transition: all 0.4s ease;
    position: relative;
    overflow: hidden;
}

.detail-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    transform: scaleX(0);
    transition: transform 0.4s ease;
}

.detail-item.winner {
    border-color: #4caf50;
    background: rgba(76,175,80,0.15);
    transform: scale(1.05);
    box-shadow: 0 10px 25px rgba(76,175,80,0.2);
}

.detail-item.winner::before {
    transform: scaleX(1);
    background: linear-gradient(90deg, #4caf50, #8bc34a);
}

.detail-item strong {
    display: block;
    font-size: 1.3em;
    margin-bottom: 8px;
}

.detail-value {
    font-size: 1.8em;
    font-weight: bold;
    color: #4caf50;
}

/* 技术详情样式 */
.tech-details {
    margin-top: 30px;
    padding: 20px;
    background: rgba(255,255,255,0.6);
    border-radius: 15px;
    font-size: 0.95em;
    color: #666;
    border-left: 4px solid #2196f3;
}

.tech-details strong {
    color: #1976d2;
    display: block;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.tech-details ul {
    margin: 10px 0;
    padding-left: 20px;
}

.tech-details li {
    margin: 5px 0;
}

/* 页脚样式 */
.footer {
    margin-top: 50px;
    padding-top: 30px;
    border-top: 2px solid #eee;
}

.api-info h3 {
    text-align: center;
    color: #333;
    margin-bottom: 20px;
    font-size: 1.5em;
}

.api-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.api-item {
    background: rgba(255,255,255,0.8);
    padding: 15px;
    border-radius: 10px;
    border-left: 4px solid #667eea;
    transition: all 0.3s ease;
}

.api-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.api-item strong {
    color: #667eea;
    font-family: 'Courier New', monospace;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 25px;
        margin: 10px;
    }
    
    .header h1 {
        font-size: 2.2em;
    }
    
    .upload-area {
        padding: 40px 20px;
    }
    
    .details-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .features-list {
        grid-template-columns: 1fr;
    }
    
    .api-list {
        grid-template-columns: 1fr;
    }
    
    button {
        padding: 15px 35px;
        font-size: 16px;
    }
}

/* 动画效果 */
.fade-in {
    animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.bounce-in {
    animation: bounceIn 0.8s ease-out;
}

@keyframes bounceIn {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.05); }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); opacity: 1; }
}